package test2;

import java.util.Scanner;

public class iphoneTest {
    public static void main(String[]args){

        iphone[] arr=new iphone[2];
        Scanner sc=new Scanner(System.in);
        for(int i=0;i<2;i++){
            iphone c=new iphone();
            System.out.println("请输入手机品牌");
            String band=sc.next();
            c.setBrand(band);
            System.out.println("请输入手机价格");
            int price=sc.nextInt();
            c.setPrice(price);
            System.out.println("请输入手机颜色");
            String color=sc.next();
            c.setColor(color);
            arr[i]=c;
        }
        for(int i=0;i<2;i++){
            iphone good=arr[i];
            System.out.println("手机品牌为"+good.getBrand()+","+"手机价格为"+
                    good.getPrice()+","+"手机颜色为"+good.getColor());
        }
        double sum=0;
        for(int i=0;i<2;i++){
            iphone number=arr[i];
            sum+=number.getPrice();
        }
        System.out.println("平均价格为"+sum/2);
    }
}

